/**
 * Created by YangYan on 2016/6/1.
 */

(function () {
    var arr=[];
    arr.push(1);
    arr.push(2);
    arr.push(3);
    var data=[];
    // arr.foreach(function (x) {
    //     if(x != null){
    //         data.push(x);
    //     }
    // });
    for(var ar in arr){
        if(ar != null){
            data.push(ar);
        }
    };
    data={"a":"0","b":"1"};
    Array.join=Array.join || function (a,sep) {
          return Array.prototype.join.call(a,sep);
        };
    Array.join(data,"+");
    //console.log(data);
    var  超毛={
        身高:"185cm" ,
        体重:"70公斤",
        年龄:40
    };
    for(var i in 超毛){
        document.write("i="+i+".......................超毛[i]:"+超毛[i]+"<br>");
    };

    var a={"a":"0","b":"1"};
    Array.prototype.join.call(a,"+");
    console.log(a instanceof Array);

    var objects=[{x:1},{y:2},{z:3}];

    var merged=objects.reduce(function (b) {
       return b;
    });
    console.log(merged);
    var data=[1,2,3,4,5];
    var sum=0;
    data.forEach(function(value){
        sum+=value;
    });
    data.forEach(function(v,i,data){
        data[i]=v+1;
    });


    function extend(o,p){
        for(prop in p){
            o[prop]=p[prop];
        }
        return o;
    }
    var data=[1,2,3,4,5];
    data.reduce(function(a,b){
        return a+b;
    });

    console.log(data);




























})();
